package health.lm.com.mine.present;

import com.scwang.smartrefresh.layout.SmartRefreshLayout;

import health.lm.com.component_base.base.mvp.contract.XPresent;
import health.lm.com.mine.activity.IntegralDetailListActivity;
import health.lm.com.mine.entity.IntegralDetailListEntity;
import health.lm.com.mine.model.MineModel;
import health.lm.com.network.callback.SimpleCallBack;
import health.lm.com.network.exception.ApiException;

/**
 * 积分明细
 * @author Administrator
 */
public class IntegralDetailListPresenter extends XPresent<IntegralDetailListActivity> {
    public void getListMore(boolean isRefresh, Object layout,int page, int pageSize) {

        MineModel.getInstance().jifenmx( page, pageSize, new SimpleCallBack<IntegralDetailListEntity>() {
            @Override
            public void onSuccess(IntegralDetailListEntity entity) {

                if (hasV()) {
                    getV().getListSuccess(entity.getCredit_log());
                }
                if (isRefresh) {
                    ((SmartRefreshLayout)layout).finishRefresh(true);
                }
            }

            @Override
            public void onError(ApiException e) {
                super.onError(e);
                if (isRefresh) {
                    ((SmartRefreshLayout)layout).finishRefresh(true);
                }
            }
        });
    }

}
